import path from "path";
import { Dialect, Sequelize } from "sequelize";

const config = {
  database: 'fifthking',
  username: 'admin',
  password: 'admin',
  options: {
    logging: false,
    host: 'localhost',
    dialect: 'sqlite' as Dialect,
    storage: path.resolve(__dirname, '../../database/fifthking.sqlite'),
    define: {
      underscored: true, // 下划线
      paranoid: true // 软删除
    }
  }
}

const sequelize = new Sequelize(config.database, config.username, config.password, config.options);
sequelize.sync(/*{ alter: { drop: false } }*/);

export default sequelize;
